<template>
  <div>
    <FilterTable
      ref="table"
      :isSelectColumn="false"
      :columns="columns"
      height="auto"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onColumnsChange="columns => this.columns = columns"
    >
    </FilterTable>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import { formatdate } from '@/utils/index';
import { getCareObjList } from '@/api/customerCare/saleVisit/potentialCustomerBirthday';

export default {
  name: 'careTask',
  mixins: [dictionary],
  components: {},
  props: {},
  data() {
    return {
      columns: this.createTableColumns(),
      fetchApi: getCareObjList,
      fetchParams: {},
      formData: {}
    };
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '计划跟进日期',
          dataIndex: 'careTypeCode',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '实际跟进日期',
          dataIndex: 'taskNo',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '实际跟进方式',
          dataIndex: 'createdAt',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '计划跟进方式',
          dataIndex: 'requiredDate',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '原级别',
          dataIndex: 'careName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '跟进后级别',
          dataIndex: 'employeeName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '经过情形',
          dataIndex: 'employeeName2',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '销售顾问',
          dataIndex: 'employeeName3',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '备注',
          dataIndex: 'employeeName4',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ]
    },
    changeHandle(val) {
      this.fetchParams = Object.assign({}, val);
    },
    closeHandler(val, type) {
      this.visible = val;
      if (type === 'refresh') {
        // 重新加载
        this.fetchParams = { ...this.fetchParams };
      }
    }
  },
  mounted() {
    this.BaseTable = this.$refs.table.$refs.pageTable;
  }
};
</script>

<style lang="less">
</style>
